#include "scene_factory.h"
#include <nel/net/service.h>
#include <nel/net/module_common.h>
#include <game_share/scene_type.h>
#include <server_share/server_def.h>

namespace ZS
{

using namespace std;
using namespace NLMISC;
using namespace NLNET;

bool CSceneFactory::init()
{
	string scene_config = IService::getInstance()->ConfigFile.getVar("SceneConfig").asString();
	NLNET::TParsedCommandLine	scene_cmd;
	scene_cmd.parseParamList(scene_config);

	for ( uint i=0; i<scene_cmd.SubParams.size(); ++i )
	{
		MSG_STR::CSceneConfig   scene;

		string scene_type_str = scene_cmd.SubParams[i]->ParamName;
		DEF::SCENE_TYPE scene_type = N_SCENE_TYPE::toSceneType( scene_type_str );
		
		scene.SceneType = scene_type;
		scene.SceneMax  = atoi(scene_cmd.SubParams[i]->ParamValue.c_str());
		scene.SceneUsed = 0;

		m_ZoneService.SceneConfig.push_back(scene);
		getGlobal_Loger().displayNL ("Scene %s.%d : %d", scene_type_str.c_str(), scene.SceneType, scene.SceneMax );
	}

	return true;
}

MSG_STR::CZoneService& CSceneFactory::GetSceneConfig()
{
	return m_ZoneService;
}

CSceneBase* CSceneFactory::creator( DEF::SCENE_TYPE scene_type )
{
	CSceneBase* pSceneBase = NULL;

	return pSceneBase;
}

}
